home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
359_09
/
patch4.000
/
LIB_GCRT0.S
< prev
next >
Wrap
Text File
|
1991-07-21
|
1KB
|
86 lines
/*
** Called as start(argc, argv, envp)
*/
.text
.globl start
start:
movl %esp,%ebx
call mcount_init
movl 8(%ebx),%eax
pushl %eax
movl %eax,_environ
pushl 4(%ebx)
pushl (%ebx)
call _main
addl $12,%esp
pushl %eax
call _exit
movl $0x4c00,%eax
int $0x21
ret
.globl __exit
__exit:
call mcount_write
movb 4(%esp),%al
movb $0x4c,%ah
int $0x21
.globl mcount_isr_init
mcount_isr_init:
movw $16,%ax
movw %ax,%gs
movl $960,%eax /* vector 0x78 * 8 bpv */
movw %gs:(%eax),%cx
movw %cx,mc_chain
movw %gs:6(%eax),%cx
movw %cx,mc_chain_hi
movw %gs:2(%eax),%cx
movw %cx,mc_chain_sel
movl $mcount_isr,%ecx
movw %cx,%gs:(%eax)
movw $64,%gs:2(%eax) /* selector 8 == 32-bit code */
movw $0x8f00,%gs:4(%eax)
rorl $16,%ecx
movw %cx,%gs:6(%eax)
movw %ds,%ax
movw %ax,%gs
ret
mcount_isr:
pushl %eax
cmpl $1,mcount_skip
je L0
movl 4(%esp),%eax
subl $0x1020,%eax
andl $0xfffffffc,%eax
shrl $1,%eax
addl mcount_histogram,%eax
incw (%eax)
L0:
popl %eax
ljmp mc_chain
.data
.globl _environ
_environ:
.long 0
mc_chain:
.short 0
mc_chain_hi:
.short 0
mc_chain_sel:
.short 0